#!/bin/bash
#
# $Id: check_key.sh 138 2011-03-16 13:36:16Z mamartynov@gmail.com $
#

. $OPENARS_HOME/common/debug.h || exit 1
. $OPENARS_HOME/common/functions.h || exit 1

[ -z "$USER_ARS" ] && USER_ARS=$LOGNAME
[ -z "$1" ] && { ERR "need parametr \"filename\""; exit 1; }
[ ! -f "$1" ] && { ERR "not find file \"$1\""; exit 1; }

srvlist=`cat $1`
INF "count hosts: `echo $srvlist | wc -w`"

for server in $srvlist
do
if [ ! -z "$USER_ARS" ]; then
    ( SSH $USER_ARS@$server "true"; [ "$?" -ne 0 ] && ERR "Error $USER_ARS key in server $server" ) &
fi
done

WAIT 180

exit 0
